﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zian.WinForm.Framework.Commons;
using Zian.WinForm.Framework.Commons.Attributes;
using Zian.WinForm.Framework.Entities;
using Zian.WinForm.Framework.Logs;
using Zian.WinForm.Framework.Tasks;
using Zian.WinForm.Framework.Utils;

namespace ZhiQianWinform.Tasks
{
    [Component]
    public class TestTask : AbstractTask
    {
        public override string TaskType => "测试任务";

        private static WfLogger logger = WfLogger.GetLogger(typeof(TestTask));

        public void WfLoggerTest()
        {
            logger.D("任务测试运行(logger)！");

            LogUtils.D(GetType(), "任务测试运行(LogUtils)！");
        }

        public void OperateLogTest()
        {
            OperLogEntity ole = new OperLogEntity();
            ole.Title = "操作日志测试";
            ole.Content = "内容";
            //ole.ErrorMsg = "错误信息";
            //ole.Status = "操作状态";
            //ole.Category = "业务类型";
            ole.Save();
        }

        public override Result Run(TaskParameter parameter)
        {
            var tr = new Result();
            logger.D("任务测试运行(logger)！");
            LogUtils.D(GetType(), "任务测试运行(LogUtils)！");
            tr.AddMessage("任务测试运行成功");
            return tr;
        }
    }
}
